<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="./dsp.js"></script>		
		<script src="./echarts.min.js"></script>
	</head>
	<body>
		<div id="ech" style="width:100%;height: 200px;"></div>
		<div id="ech2" style="width:100%;height: 200px;"></div>
		<div id="ech3" style="width:100%;height: 200px;"></div>
		<div id="ech4" style="width:100%;height: 200px;"></div>
		<div id="ech5" style="width:100%;height: 200px;"></div>
		<div id="ech6" style="width:100%;height: 200px;"></div>
		<div id="ech7" style="width:100%;height: 200px;"></div>
		<div id="ech8" style="width:100%;height: 200px;"></div>
		<button onclick="echartManager2.stopUpdate()">停止</button>
	</body>
</html>
<script type="module">
	import {echartManager,workerManager} from "./signal.js";	
	let echartObjs=[
		echarts.init(document.getElementById('ech')),
		echarts.init(document.getElementById('ech2')),
		echarts.init(document.getElementById('ech3')),
		echarts.init(document.getElementById('ech4')),
		echarts.init(document.getElementById('ech5')),
		echarts.init(document.getElementById('ech6')),
		echarts.init(document.getElementById('ech7')),
		echarts.init(document.getElementById('ech8')),
	];
	echartObjs.forEach(v=>{
		v.setOption({
			xAxis: {type: 'category',boundaryGap: false,data:[]},
			yAxis:{type:'value'},
			tooltip: {
				trigger: 'axis',
				animation:false
			},
			series:[{animation:false,type: 'line',data:[],symbol: 'none'}],
		});
	})
	
	
	let fs=500000,cacheTimeLen=1;
	let len=fs*cacheTimeLen;
	let worker=workerManager();
	let soc=worker.open({
		socketName:'test',
		ws:"ws://192.168.0.164:8088",
		fs,//采样频率
		channelNum:8,//通道数
		cacheTimeLen//缓存时长
	});
	
	
	let echartManager2=echartManager();
	echartManager2.add(echartObjs[0],1,len,soc);
	echartManager2.add(echartObjs[1],2,len,soc);
	echartManager2.add(echartObjs[2],3,len,soc);
	echartManager2.add(echartObjs[3],4,len,soc);
	/*echartManager2.add(echartObjs[4],5,len,soc);
	echartManager2.add(echartObjs[5],6,len,soc);
	echartManager2.add(echartObjs[6],7,len,soc);
	echartManager2.add(echartObjs[7],8,len,soc); */
	echartManager2.startUpdate(20,true);
</script>